SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_SearchApplyFieldNew]
    (
      @JOL_Field_ApplyCompany VARCHAR(50) ,
      @JOL_Field_Purpose VARCHAR(100) ,
      @JOL_Field_ApplyPosition VARCHAR(50),
      @JOL_Field_VerifyStatus VARCHAR (50)
    )
AS 
    SELECT  a.JOL_Field_No ,
            b.JOL_Employer_Name ,
            a.JOL_Field_Purpose ,
            a.JOL_Field_Action ,
            a.JOL_Field_ApplyTime ,
            a.JOL_Field_ApplyPosition ,
            a.JOL_Field_VerifyStatus ,
            a.JOL_ApplyField_Email,
            a.JOL_ApplyField_EndTime,
            a.JOL_Field_Remark,
			a.JOL_Field_Linkman,
			a.JOL_Field_Contact,
			a.JOL_ApplyField_Phone,
			a.JOL_ApplyField_Fax,
            a.JOL_ApplyField_Log	
    FROM    dbo.JOL_ApplyField AS a
            INNER JOIN dbo.JOL_Employer AS b ON a.JOL_Field_ApplyCompany = b.JOL_Employer_Account
    WHERE   ( a.JOL_Field_Purpose LIKE '%' + @JOL_Field_Purpose + '%' )
            AND ( a.JOL_Field_ApplyPosition LIKE '%'
                  + @JOL_Field_ApplyPosition + '%' )
            AND ( b.JOL_Employer_Name LIKE '%' + @JOL_Field_ApplyCompany + '%' )
            AND (a.JOL_Field_VerifyStatus Like  '%' + @JOL_Field_VerifyStatus + '%' )
            --AND NOT ( a.JOL_Field_Purpose = '宣讲会' )
--    ORDER BY a.JOL_Field_VerifyStatus ,
--            a.JOL_Field_UpdateTime DESC
    ORDER BY a.JOL_Field_ApplyTime DESC







GO
